<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="layui/css/layui.css">
    <style>
        div {
            width: 400px;
            height: 400px;
            border-radius: 50%;
            background-color: red;
        }
    </style>
</head>

<body>
    <div></div>
    <script src="layui/layui.js"></script>
    <script>

        setInterval('big()', 800);
        var div = document.getElementsByTagName('div')[0];

        var width = div.offsetWidth;
        var height = div.offsetHeight;
        var flag = true;
        function big() {
            if (flag) {
                width += 10;
                height += 10;
                if(width == 600){
                    flag = false;
                }

            } else {
                width -= 10;
                height -= 10;
                if(width == 400){
                    flag = true;
                }
            }
            div.style.width = width + "px";
            div.style.height = height + "px";

        }
    </script>
</body>

</html>